home *** CD-ROM | disk | FTP | other *** search
- /* routine to initialize stuff.... for the mergeIndices project
- * ^z 871203-... revised 871230 for XFCN use... return 1 if succeeds,
- * 0 on error....
- *
- * Note that the zbufsiz is defined so that it is an exact multiple of
- * the size of a key record and a ptr record....important to do so!
- */
-
- #include "mergeIndices.z.h"
-
- extern WindowRecord w_record;
- extern WindowPtr info_window;
- extern char *buf[3][2], *bufp[3][2];
- extern long bufcount[3][2], zbufsiz;
- extern int x0, y0;
-
- int init_everything (paramPtr)
- XCmdBlockPtr paramPtr;
- {
- int i, j;
- Str255 string;
- Rect b_rect;
- Ptr testzbufsiz;
-
- if (paramPtr->paramCount != 3)
- {
- SysBeep (10);
- return (0);
- }
- x0 = atol (*(paramPtr->params[0]));
- y0 = atol (*(paramPtr->params[1]));
- zbufsiz = atol (*(paramPtr->params[2]));
- zbufsiz /= 6;
- zbufsiz = zbufsiz - zbufsiz % (sizeof(KEY_REC) * sizeof(long));
-
- b_rect.top = 30 + y0;
- b_rect.left = 12 + x0;
- b_rect.bottom = 52 + y0;
- b_rect.right = 500 + x0;
- info_window = NewWindow (&w_record, &b_rect, "\p", (Boolean)1, dBoxProc,
- (WindowPtr)-1, (Boolean)0, (long)0);
- ShowWindow (info_window);
- SetPort (info_window);
- TextFont (0);
- give_msg ("\pWelcome to mergeIndices by ^z!");
-
- if (zbufsiz < sizeof(KEY_REC) * sizeof(long))
- {
- give_msg ("\pBad choice for buffer size -- too small!! Click mouse to exit...");
- beepWait ();
- return (0);
- }
-
- if ((testzbufsiz = NewPtr (zbufsiz * 6)) == NULL)
- {
- give_msg ("\pBad choice for buffer size -- too big!! Click mouse to exit...");
- beepWait ();
- return (0);
- }
-
- DisposPtr (testzbufsiz);
-
-
- for (i = 0; i < 3; ++i)
- for (j = 0; j < 2; ++j)
- {
- if ((buf[i][j] = NewPtr (zbufsiz)) == NULL)
- {
- give_msg ("\pFatal error allocating a merge buffer! Click mouse to exit...");
- beepWait ();
- return (0);
- }
- else
- {
- bufp[i][j] = buf[i][j];
- bufcount[i][j] = 0;
- }
- }
-
- return (1);
- }
-
-
-